﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.Remoting.Contexts;
using System.Text;

using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Web;
using Microsoft.VisualBasic.FileIO;

namespace CommonLibrary
{
    public class WebClientTimeout : WebClient
    {
        private int _timeout;

        public int Timeout
        {
            get { return _timeout; }
            set { _timeout = value; }
        }

        public WebClientTimeout()
        {
            //this._timeout = 180000;//默认3分钟超时
            this._timeout = 3600000;//默认60分钟超时
        }

        public WebClientTimeout(int timeout)
        {
            this._timeout = timeout;
        }

        protected override WebRequest GetWebRequest(Uri address)
        {
            WebRequest result = base.GetWebRequest(address);
            result.Timeout = this._timeout;
            return result;
        }
    }

}
